Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Limit video attachment size #383

Merged
merged 4 commits into from
Nov 22, 2024

Conversation

bensteinberg
Copy link
Contributor

This PR limits video attachment size to 200MB by default, and makes it configurable. See Linear issue LIL-2879 for some discussion. Initially, I thought we would truncate the video attachment at the specified size, but this is likely to be fussy, and I think would introduce a dependency on ffmpeg. As it stands, a primary video on a page that is larger than the setting will not be saved as an attachment.

Additionally, this PR corrects one default, and updates the package macos-release, so that developers using Sequoia can continue their work :) Thanks to @matteocargnelutti for the tip on the package update, and to @rebeccacremona for consultation.

Copy link
Contributor

@rebeccacremona rebeccacremona left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for tackling this!

One suggestion about readability. When I added the check to make sure that the metadata.json wasn't empty, I originally wrote code that looked a lot like this, and Matteo suggested exiting early instead, in order to avoid nesting. #377. I think possibly the same kind of tweak could work here?

If you don't think so, feel free to ignore :-)

Scoop.js Outdated
@@ -948,14 +949,19 @@ export class Scoop {
const body = await readFile(`${this.captureTmpFolderPath}${file}`)
const isEntryPoint = false // TODO: Reconsider whether this should be an entry point.

this.addGeneratedExchange(url, httpHeaders, body, isEntryPoint)
videoSaved = true
if (body.length) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How would you feel about checking for if !body.length and then continueing, instead of setting videoSaved and then checking it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Yes, let me overhaul this -- I was thinking the way I did it might not be idiomatic or concise.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I can't take out your block, as that return is what prevents the summary from being created.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, or maybe I can move it up higher.

@bensteinberg
Copy link
Contributor Author

I'm not sure the changes I just made are exactly what you had in mind. I now continue in case there's no video, removing some nesting; and I move your block up above the metadata creation step.

@rebeccacremona
Copy link
Contributor

I'm not sure the changes I just made are exactly what you had in mind. I now continue in case there's no video, removing some nesting; and I move your block up above the metadata creation step.

Yeah! That's exactly what I had in mind!

@bensteinberg bensteinberg merged commit 159b374 into harvard-lil:main Nov 22, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants